package com.api.department.getdocumentsbyid;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IDepartmentApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.DocumentOrderFieldFilterApiType;
import com.zyncro.api.model.OrderFilterApiType;

@ContextConfiguration(locations = "classpath:/department/departments-toget.xml")
public class GetDocumentsExternalById extends AbstractApiTest {

	@Value("#{user_external.appId}")
	private String userUrn;

	@Value("#{user_external.password}")
	private String userPassword;

	@Value("#{department_toGet.urn}")
	private String iddepartment;

	@Value("#{department_toGet.fileUrn}")
	private String iddocument;

	@BeforeClass
	protected void loginUser() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test(expectedExceptions = ZyncroApiException.class)
	public void test() throws ZyncroApiException {
		List<String> documents = new ArrayList<String>();
		documents.add(iddocument);

		DocumentOrderFieldFilterApiType orderFilterField = null;
		OrderFilterApiType orderFilterType = null;

		getApi().getService(IDepartmentApiService.class).getDocumentsByIds(iddepartment, documents, orderFilterField, orderFilterType);
	}
}
